import type { VNode } from 'vue';

import { h } from 'vue';

import { isString } from '@eacloud/utils';

import Icon from '@/components/Icon/Icon.vue';

export const TreeIcon = ({ icon }: { icon: string | undefined | VNode }) => {
  if (!icon) return null;
  if (isString(icon)) {
    return h(Icon, { icon, class: 'mr-2' });
  }
  return h(Icon);
};
